from selenium import webdriver
import time
import os
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome()
url = "file:///"+os.path.abspath("C:\\课件\\我的课件\\测试\\selenium2/locateElement/selenium2html/modal.html")
driver.get(url)
driver.maximize_window()
time.sleep(3)
# 点击click 出现弹框
driver.find_element_by_link_text("Click").click()
time.sleep(3)

# 点击div 框框里面的click me，让弹出框内容发生变化
div1 = driver.find_element_by_class_name("modal-body")
div1.find_element_by_link_text("click me").click()
time.sleep(4)

# 定位div 在定位具体的button
div2 = driver.find_element_by_class_name("modal-footer")
buttons = driver.find_elements_by_tag_name("button")
buttons[0].click()
time.sleep(6)

driver.quit()
